#include <iostream>

static int gcd(int a, int b)
{
	if (a == 0)
		return b;
	if (b == 0)
		return a;
	while (1)
	{
		int rem = a % b;
		if (rem == 0)
			return b;
		a = b;
		b = rem;
	}
}

static int read_int()
{
	int n = 0;
	std::cin >> n;
	return n;
}

static bool run_case()
{
	// Input number of numbers on the ring.
	int n = read_int();
	if (n <= 0)
		return false;

	// Input swap operation.
	int a = read_int();
	int b = read_int();
	int d = abs(b - a);
	int g = gcd(d, n);

	// Test the numbers.
	bool ok = true;
	for (int a_0 = read_int(), i = 1; i < n; i++)
	{
		int a_i = read_int();
		ok = ok && ((a_i - a_0 - i) % g == 0);
	}
	std::cout << (ok? "Yes" : "No") << std::endl;
	return true;
}

void astar_2011_r1b_1()
{
	while (run_case());
}
